package com.action.setting;

import java.util.List;

import com.action.common.WEB;
import com.opensymphony.xwork2.ActionSupport;
import com.pojo.job.pa.PAMenu;
import com.pojo.job.pa.PAType;
import com.service.job.pa.IPAMenuService;
import com.service.job.pa.IPATypeService;
import com.util.ActionLog;

public class JobMenuAction extends ActionSupport {
	
	private static final long serialVersionUID = 1L;
	private Integer type;
	private IPAMenuService paMenuService;
	private IPATypeService paTypeService;
	private List<PAType> patypes; 
	private Integer menuId;
	private PAMenu  paMenu;
	
	// getter setter
	
	public void setPaMenuService(IPAMenuService paMenuService) {
		this.paMenuService = paMenuService;
	}

	public PAMenu getPaMenu() {
		return paMenu;
	}

	public void setPaMenu(PAMenu paMenu) {
		this.paMenu = paMenu;
	}

	public Integer getMenuId() {
		return menuId;
	}

	public void setMenuId(Integer menuId) {
		this.menuId = menuId;
	}

	public void setPaTypeService(IPATypeService paTypeService) {
		this.paTypeService = paTypeService;
	}
	
	public List<PAType> getPatypes() {
		return patypes;
	}

	public void setPatypes(List<PAType> patypes) {
		this.patypes = patypes;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	//action method
	
	public String findPAMenuByType(){
		//List<PAMenu> temps = paMenuService.findPAMenuByType(this.getType());
		return SUCCESS;
	}
	
	public String initPAMenuData(){
		ActionLog.info(JobMenuAction.class,"["+WEB.getClassName(this.getClass())+"]:系统设置-->表单管理-->行政人事：【初始化表单菜单】");
		List<PAType> temps = paTypeService.findAllPAType();
		if(temps==null||temps.size()==0){
			ActionLog.info(JobMenuAction.class,"系统设置-->表单管理-->行政人事：【初始化表单菜单为空】");
			return "uninit";
		}
		this.setPatypes(temps);
		return SUCCESS;
	}
	
	public String initSettingData(){
		ActionLog.info(JobMenuAction.class,"["+WEB.getClassName(this.getClass())+"]:系统设置-->表单管理：【進入表單設置，獲取需要設置的表單】");
		PAMenu temp = paMenuService.get(this.getMenuId());
		this.setPaMenu(temp);
		return SUCCESS;
	}
}
